package 笔试.A2022美团;

import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String arg[]){//main--来自高金磊

         Scanner scanner=new Scanner(System.in);
         int n=scanner.nextInt();
         int m=scanner.nextInt();
         int boom[]=new int[m];
        for (int i = 0; i < m; i++) {
            boom[i]=scanner.nextInt();
        }
        HashSet<Integer> middle=new HashSet<>();
        int res=0;
        boolean target=true;
        int i=0;
        for (; i < boom.length; i++) {
            if (boom[i]==1){
                res++;
                break;
            }
        }
        for (; i < boom.length; i++) {
            middle.add(boom[i]);
            if(middle.size()==n){
                res++;
                middle.clear();
            }
        }
        System.out.println(res);

    }
}
